//
//  UISegmentController.swift
//  HHSwift
//
//  Created by 华宏 on 2019/9/19.
//  Copyright © 2019 huahong. All rights reserved.
//

import UIKit

class UISegmentController: BaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()

        
        view.addSubview(segment)
    }
    

    lazy var segment:UISegmentedControl = {
    
        let segment = UISegmentedControl(items: ["111","222"])
        segment.frame = CGRect(x: 20, y: 100, width: kScreenWidth-40, height: 50)
        segment.selectedSegmentIndex = 0
        segment.addTarget(self, action: #selector(segmentAction(segment:)), for: .valueChanged)
        return segment
    }()
    
    
   @objc func segmentAction(segment:UISegmentedControl) {
        
        print("selectedSegmentIndex:\(segment.selectedSegmentIndex)")
    }

}


